//
//  TriangleScene.h
//  Ray Tracer
//
//  Created by Kaila, Ashish on 4/14/13.
//  Copyright (c) 2013 Kaila, Ashish. All rights reserved.
//

#ifndef Ray_Tracer_TriangleScene_h
#define Ray_Tracer_TriangleScene_h

void renderTriangleScene(Raytracer& raytracer,
                           int width,
                           int height,
                           bool enableSpecular)
{
    // Camera parameters.
	Point3D eye(0, 0, 1);
	Vector3D view(0, 0, -1);
	Vector3D up(0, 1, 0);
	double fov = 60;
    
	// Defines a material for shading.
    SolidMaterial jade(Colour(0, 0, 0),
                       Colour(0.54, 0.89, 0.63),
                       Colour(0.316228, 0.316228, 0.316228),
                       12.8,
                       0,
                       0,
                       0);
    
	// Defines a point light source.
	raytracer.addLightSource( new PointLight(Point3D(0, 0, 5),
                                             Colour(0.9, 0.9, 0.9) ),
                             enableSpecular);
    
	// Add a unit square into the scene with material mat.
	Point3D firstVertex(-1, 0, -1);
    Point3D secondVertex(1, 0, -1);
    Point3D thirdVertex(0, 1, -1);
    
    SceneDagNode* triangle = raytracer.addObject( new TriangleShape(firstVertex, secondVertex, thirdVertex, &jade));
	
	SceneObject* triangleObj = triangle->obj;
	/*sphereObj->translate(Vector3D(0, 0, -5));
	sphereObj->rotate('x', -45);
	sphereObj->rotate('z', 45);
	sphereObj->scale(Point3D(0, 0, 0), factor1);
    */
    
	// Render the scene, feel free to make the image smaller for
	// testing purposes.
	raytracer.render(width, height, eye, view, up, fov, "triangle1.bmp");
	
	// Render it from a different point of view.
    Point3D eye2(4, 2, 1);
	Vector3D view2(-4, -2, -6);
	raytracer.render(width, height, eye2, view2, up, fov, "triangle2.bmp");
}


#endif
